//
//  TestViewController.m
//  huashiedu
//
//  Created by oceans on 2018/9/10.
//  Copyright © 2018年 hema. All rights reserved.
//

#import "TestViewController.h"
#import "OAuthAPI.h"
#import "HttpRequest.h"

@interface TestViewController ()

@end

@implementation TestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    button.frame = CGRectMake(100, 100, 100, 100);
    button.backgroundColor = [UIColor redColor];
    [button addTarget:self action:@selector(getToken) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:button];
}

- (void)getToken {
    
    NSString *token = [OAuthAPI getAccessToken];
    
    NSLog(@"第一次原始token：%@\n第一次加密token：%@\n新token：%@", [[NSUserDefaults standardUserDefaults] objectForKey:@"firsttoken"], [[NSUserDefaults standardUserDefaults] objectForKey:@"firstaestoken"], token);
    
    [HttpRequest getURL:@"http://huashi.api.emhome.cn/site/home" paras:nil showProgress:NO successful:^(id  _Nullable result) {
        
    } failed:^(int code, NSString *errMsg) {
        
    }];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
